<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>do-while 语句</title>
</head>
<body>
	<h1>do-while 语句举例</h1><hr>
	<form id="form1" name="form1">
		<input type="text" id="Num1" name="Num1" size="15" value="行数">
		<input type="text" id="Num2" name="Num2" size="15" value="列数">
		<input type="button" value="列表格" onclick="NumSubmit();">
	</form>
	<script type="text/javascript">
	<!--	
		function NumSubmit() {
			InputNum1 = document.form1.Num1.value;
			InputNum2 = document.form1.Num2.value;
			if(isNaN(InputNum1) || isNaN(InputNum2)) {
				alert("不是数值");
			} else {
				if(InputNum1=="" || InputNum2=="") {
					alert("不能为空");
				} else {
					showTable(InputNum1, InputNum2);
				}
			} 
			function showTable(Numb1, Numb2) {
				var Numb1, Numb2;
				var n=1, m=1;
				if(Numb1<1 || Numb2 <1) {
					alert("<1");
				} else {
					if(Numb1>100 || Numb2>100) {
					alert(">100");
					} else {
						document.write("<head><title>输出结果</title></head>");
						document.write("使用while循环语句的输出的" + Numb1 + "行" + Numb2 + "列的表格<br><br>");
						document.write("<table border='1' bordercolor='green' cellpadding='10' cellspacing='10'>");
						do {
							document.write("<tr>");
							do {
								document.write("<td align='center'>第" + m + "行第" + n + "列<tb>");
								n++;
							} while(n<=Numb2);
							document.write("</tr>");
							m++;
							n=1;
						} while(m<=Numb1);
						document.write("</table>");
					}
				}
				
			}
		}
	//-->	
	</script>
</body>
</html>